\(\int \frac {\cos ^2(c+d x) (a B+b B \cos (c+d x))}{a+b \cos (c+d x)} \, dx\) [282]

   Optimal result
   Rubi [A] (verified)
   Mathematica [A] (verified)
   Maple [A] (verified)
   Fricas [A] (verification not implemented)
   Sympy [B] (verification not implemented)
   Maxima [F(-2)]
   Giac [A] (verification not implemented)
   Mupad [B] (verification not implemented)

Optimal result

Integrand size = 34, antiderivative size = 27 \[ \int \frac {\cos ^2(c+d x) (a B+b B \cos (c+d x))}{a+b \cos (c+d x)} \, dx=\frac {B x}{2}+\frac {B \cos (c+d x) \sin (c+d x)}{2 d} \]

[Out]

1/2*B*x+1/2*B*cos(d*x+c)*sin(d*x+c)/d

Rubi [A] (verified)

Time = 0.01 (sec) , antiderivative size = 27, normalized size of antiderivative = 1.00, number of steps used = 3, number of rules used = 3, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.088, Rules used = {21, 2715, 8} \[ \int \frac {\cos ^2(c+d x) (a B+b B \cos (c+d x))}{a+b \cos (c+d x)} \, dx=\frac {B \sin (c+d x) \cos (c+d x)}{2 d}+\frac {B x}{2} \]

[In]

Int[(Cos[c + d*x]^2*(a*B + b*B*Cos[c + d*x]))/(a + b*Cos[c + d*x]),x]

[Out]

(B*x)/2 + (B*Cos[c + d*x]*Sin[c + d*x])/(2*d)

Rule 8

Int[a_, x_Symbol] :> Simp[a*x, x] /; FreeQ[a, x]

Rule 21

Int[(u_.)*((a_) + (b_.)*(v_))^(m_.)*((c_) + (d_.)*(v_))^(n_.), x_Symbol] :> Dist[(b/d)^m, Int[u*(c + d*v)^(m +
 n), x], x] /; FreeQ[{a, b, c, d, n}, x] && EqQ[b*c - a*d, 0] && IntegerQ[m] && ( !IntegerQ[n] || SimplerQ[c +
 d*x, a + b*x])

Rule 2715

Int[((b_.)*sin[(c_.) + (d_.)*(x_)])^(n_), x_Symbol] :> Simp[(-b)*Cos[c + d*x]*((b*Sin[c + d*x])^(n - 1)/(d*n))
, x] + Dist[b^2*((n - 1)/n), Int[(b*Sin[c + d*x])^(n - 2), x], x] /; FreeQ[{b, c, d}, x] && GtQ[n, 1] && Integ
erQ[2*n]

Rubi steps \begin{align*} \text {integral}& = B \int \cos ^2(c+d x) \, dx \\ & = \frac {B \cos (c+d x) \sin (c+d x)}{2 d}+\frac {1}{2} B \int 1 \, dx \\ & = \frac {B x}{2}+\frac {B \cos (c+d x) \sin (c+d x)}{2 d} \\ \end{align*}

Mathematica [A] (verified)

Time = 0.01 (sec) , antiderivative size = 24, normalized size of antiderivative = 0.89 \[ \int \frac {\cos ^2(c+d x) (a B+b B \cos (c+d x))}{a+b \cos (c+d x)} \, dx=\frac {B (2 (c+d x)+\sin (2 (c+d x)))}{4 d} \]

[In]

Integrate[(Cos[c + d*x]^2*(a*B + b*B*Cos[c + d*x]))/(a + b*Cos[c + d*x]),x]

[Out]

(B*(2*(c + d*x) + Sin[2*(c + d*x)]))/(4*d)

Maple [A] (verified)

Time = 0.81 (sec) , antiderivative size = 21, normalized size of antiderivative = 0.78

method result size
risch \(\frac {x B}{2}+\frac {B \sin \left (2 d x +2 c \right )}{4 d}\) \(21\)
parallelrisch \(\frac {B \left (2 d x +\sin \left (2 d x +2 c \right )\right )}{4 d}\) \(21\)
derivativedivides \(\frac {B \left (\frac {\cos \left (d x +c \right ) \sin \left (d x +c \right )}{2}+\frac {d x}{2}+\frac {c}{2}\right )}{d}\) \(28\)
default \(\frac {B \left (\frac {\cos \left (d x +c \right ) \sin \left (d x +c \right )}{2}+\frac {d x}{2}+\frac {c}{2}\right )}{d}\) \(28\)
norman \(\frac {\frac {B \tan \left (\frac {d x}{2}+\frac {c}{2}\right )}{d}+\frac {x B}{2}-\frac {B \left (\tan ^{5}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{d}+\frac {3 x B \left (\tan ^{2}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{2}+\frac {3 x B \left (\tan ^{4}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{2}+\frac {x B \left (\tan ^{6}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{2}}{\left (1+\tan ^{2}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )^{3}}\) \(98\)

[In]

int(cos(d*x+c)^2*(B*a+b*B*cos(d*x+c))/(a+cos(d*x+c)*b),x,method=_RETURNVERBOSE)

[Out]

1/2*x*B+1/4*B/d*sin(2*d*x+2*c)

Fricas [A] (verification not implemented)

none

Time = 0.30 (sec) , antiderivative size = 24, normalized size of antiderivative = 0.89 \[ \int \frac {\cos ^2(c+d x) (a B+b B \cos (c+d x))}{a+b \cos (c+d x)} \, dx=\frac {B d x + B \cos \left (d x + c\right ) \sin \left (d x + c\right )}{2 \, d} \]

[In]

integrate(cos(d*x+c)^2*(a*B+b*B*cos(d*x+c))/(a+b*cos(d*x+c)),x, algorithm="fricas")

[Out]

1/2*(B*d*x + B*cos(d*x + c)*sin(d*x + c))/d

Sympy [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 68 vs. \(2 (22) = 44\).

Time = 0.39 (sec) , antiderivative size = 68, normalized size of antiderivative = 2.52 \[ \int \frac {\cos ^2(c+d x) (a B+b B \cos (c+d x))}{a+b \cos (c+d x)} \, dx=\begin {cases} \frac {B x \sin ^{2}{\left (c + d x \right )}}{2} + \frac {B x \cos ^{2}{\left (c + d x \right )}}{2} + \frac {B \sin {\left (c + d x \right )} \cos {\left (c + d x \right )}}{2 d} & \text {for}\: d \neq 0 \\\frac {x \left (B a + B b \cos {\left (c \right )}\right ) \cos ^{2}{\left (c \right )}}{a + b \cos {\left (c \right )}} & \text {otherwise} \end {cases} \]

[In]

integrate(cos(d*x+c)**2*(a*B+b*B*cos(d*x+c))/(a+b*cos(d*x+c)),x)

[Out]

Piecewise((B*x*sin(c + d*x)**2/2 + B*x*cos(c + d*x)**2/2 + B*sin(c + d*x)*cos(c + d*x)/(2*d), Ne(d, 0)), (x*(B
*a + B*b*cos(c))*cos(c)**2/(a + b*cos(c)), True))

Maxima [F(-2)]

Exception generated. \[ \int \frac {\cos ^2(c+d x) (a B+b B \cos (c+d x))}{a+b \cos (c+d x)} \, dx=\text {Exception raised: ValueError} \]

[In]

integrate(cos(d*x+c)^2*(a*B+b*B*cos(d*x+c))/(a+b*cos(d*x+c)),x, algorithm="maxima")

[Out]

Exception raised: ValueError >> Computation failed since Maxima requested additional constraints; using the 'a
ssume' command before evaluation *may* help (example of legal syntax is 'assume(4*b^2-4*a^2>0)', see `assume?`
 for more de

Giac [A] (verification not implemented)

none

Time = 0.28 (sec) , antiderivative size = 33, normalized size of antiderivative = 1.22 \[ \int \frac {\cos ^2(c+d x) (a B+b B \cos (c+d x))}{a+b \cos (c+d x)} \, dx=\frac {{\left (d x + c\right )} B + \frac {B \tan \left (d x + c\right )}{\tan \left (d x + c\right )^{2} + 1}}{2 \, d} \]

[In]

integrate(cos(d*x+c)^2*(a*B+b*B*cos(d*x+c))/(a+b*cos(d*x+c)),x, algorithm="giac")

[Out]

1/2*((d*x + c)*B + B*tan(d*x + c)/(tan(d*x + c)^2 + 1))/d

Mupad [B] (verification not implemented)

Time = 0.91 (sec) , antiderivative size = 50, normalized size of antiderivative = 1.85 \[ \int \frac {\cos ^2(c+d x) (a B+b B \cos (c+d x))}{a+b \cos (c+d x)} \, dx=\frac {B\,x}{2}+\frac {B\,\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )-B\,{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^3}{d\,{\left ({\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^2+1\right )}^2} \]

[In]

int((cos(c + d*x)^2*(B*a + B*b*cos(c + d*x)))/(a + b*cos(c + d*x)),x)

[Out]

(B*x)/2 + (B*tan(c/2 + (d*x)/2) - B*tan(c/2 + (d*x)/2)^3)/(d*(tan(c/2 + (d*x)/2)^2 + 1)^2)